<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<style>
    .layui-table[lay-skin=line] td, .layui-table[lay-skin=line] th{
        max-width: 300px;
    }
    .layui-table th, .layui-table td{
        padding: 9px 6px;
        text-align: center;
    }
    .operation-menu a{
        margin: 5px 0;!important;
    }

</style>
<body>
<div class="layui-fluid main">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <div class="layui-form-item" style="float: left;">
            <form class="layui-form serch" action="{:url('admin/Order/index')}" method="post">
                <div class="layui-form-item" style="float: left;">


                    <div class="layui-input-inline">
                        <input type="text" name="order_no" value="{if isset($wherelist['order_no'])}{$wherelist['order_no']}{/if}" lay-verify="title" autocomplete="off" placeholder="订单编号" class="layui-input layui-btn-sm">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="phone" value="{if isset($wherelist['phone'])}{$wherelist['phone']}{/if}" lay-verify="title" autocomplete="off" placeholder="联系号码" class="layui-input layui-btn-sm">
                    </div>
                    <div class="layui-input-inline" >
                        <input name="creattime" value="{if isset($wherelist['creattime'])}{$wherelist['creattime']}{/if}"  id="creattime"   placeholder="查询创建时间" autocomplete="off" class="layui-input" type="text">
                    </div>

                    <div class="layui-input-inline" >
                        <input name="travelDate" value="{if isset($wherelist['travelDate'])}{$wherelist['travelDate']}{/if}"  id="travelDate"   placeholder="查询出行时间" autocomplete="off" class="layui-input" type="text">
                    </div>


                    <div class="layui-input-inline">
                        <div class="layui-inline">
                            <select name="goods_source" lay-search="">
                                <option value="">供应商</option>
                                <option value="1" {if isset($wherelist['goods_source']) AND $wherelist['goods_source']==1 }selected{/if}>自营</option>
                                <option value="2" {if isset($wherelist['goods_source']) AND $wherelist['goods_source']==2 }selected{/if}>第三方</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-input-inline">
                        <div class="layui-inline">
                            <select name="order_status" lay-search="">
                                <option value="">订单状态</option>
                                <option value="1" {if isset($wherelist['order_status']) AND $wherelist['order_status']==1 }selected{/if}>待付款</option>
                                <option value="2" {if isset($wherelist['order_status']) AND $wherelist['order_status']==2 }selected{/if}>已付款待使用</option>
                                <option value="3" {if isset($wherelist['order_status']) AND $wherelist['order_status']==3 }selected{/if}>已使用待评价</option>
                                <option value="4" {if isset($wherelist['order_status']) AND $wherelist['order_status']==4 }selected{/if}>已评价</option>
                                <option value="5" {if isset($wherelist['order_status']) AND $wherelist['order_status']==5 }selected{/if}>退款中</option>
                                <option value="6" {if isset($wherelist['order_status']) AND $wherelist['order_status']==6 }selected{/if}>已取消</option>
                                <option value="7" {if isset($wherelist['order_status']) AND $wherelist['order_status']==7 }selected{/if}>已过期</option>
                                <option value="8" {if isset($wherelist['order_status']) AND $wherelist['order_status']==8 }selected{/if}>已退款</option>
                                <option value="9" {if isset($wherelist['order_status']) AND $wherelist['order_status']==9 }selected{/if}>拒绝退款</option>
                                <option value="10" {if isset($wherelist['order_status']) AND $wherelist['order_status']==10 }selected{/if}>下单和退款失败</option>

                            </select>
                        </div>
                    </div>

                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                    <a href="{:url('admin/order/index')}?exportFlag=1" class="layui-btn layui-btn-default layui-btn-sm">导出Excel</a>
                </div>
            </form>

        </div>
    </fieldset>
    <table class="layui-table" lay-even="" lay-skin="line">
        <colgroup>
            <col width="8%">
            <col width="8%">
            <col width="8%">
            <col width="8%">
            <col width="8%">
            <col width="12%">
            <col width="12%">
            <col width="12%">
            <col width="12%">
            <col width="12%">
            <col width="12%">
        </colgroup>
        <thead>

        <tr>
            <th>订单编号</th>
            <th>商品名</th>
            <th>会员名</th>
            <th>订单金额</th>
            <th>联系电话</th>
            <th>订单状态</th>
            <th>二次确认</th>
            <th>下单时间</th>
            <th>出行时间</th>
            <th>支付渠道</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr>

            {volist name='order' id='vo'}
            <td>{$vo.order_no}</td>
            <td title="{$vo.goods.goods_name}" style=" overflow: hidden;text-overflow:ellipsis; white-space: nowrap; vertical-align: middle;"> {$vo.goods.goods_name}</td>
            <td class="">
                {$vo.member.member_nickname}
            </td>

            <td><span style="color: #FF4E42"><b>{$vo.fold_money}</b></span></td>
            <td>{$vo.phone}</td>
            <td>

                <?php if($vo['isdelete']==0){
                      ?>


                <?php if($vo['refund_status']==0){?>
                {switch name="vo.order_status"}
                {case value="1"}待付款{/case}
                {case value="2"}已付款待使用{/case}
                {case value="3"} 已使用待评价 {/case}
                {case value="4"} 已评价 {/case}
                {case value="5"} 退款中 {/case}
                {case value="6"} 已取消 {/case}
                {case value="7"} 已过期 {/case}
                {case value="8"} 已退款 {/case}
                {case value="9"} 拒绝退款 {/case}
                {case value="10"} 下单退款失败 {/case}
                {default /}default
                {/switch}
                <?php  }else{?>

                {switch name="vo.refund_status"}
                {case value="0"}{/case}
                {case value="1"}<span style="color: red">申请退款中</span>{/case}
                {case value="2"}退款成功{/case}
                {case value="3"}拒绝退款{/case}
                {default /}
                {/switch}

                <?php }?>

                <?php  }else{?>
                订单已删除
                <?php  }?>


            </td>

            <td>
                {switch name="vo.speedstatus"}
                {case value="0"} 无需确认{/case}
                {case value="1"} 确认中{/case}
                {case value="2"} 已确认完成{/case}
                {case value="3"}{if($vo.source == 1 )} <a href="####" class="layui-btn layui-btn-xs layui-btn-danger confirm"  codeid="{$vo.order_id}" style="margin-right: 0;font-size:12px;">待确认</a>{else/}无需确认{/if}{/case}
                {default /}
                {/switch}
            </td>

            <td>{$vo.creattime}</td>
            <td>{$vo.travelDate}</td>
            <td>
                {switch name="vo.payType"}
                {case value="1"}微信{/case}
                {case value="2"}信用卡{/case}
                {default /}
                {/switch}
            </td>
            <td class="operation-menu">
                <a href="{:url('admin/order/Details')}?id={$vo.order_id}&source={$vo.source}&order_no={$vo.order_no}" class="layui-btn layui-btn-xs layui-btn-warm a_menu"  style="margin-right: 0;font-size:12px;background: darkslategrey">查看</a>

                <?php if($vo['isdelete']==0){
                      ?>
                {switch name="vo.order_status"}
                {case value="3"} <a href="####" class="layui-btn layui-btn-xs layui-btn-danger " data-id="{$vo.order_id}" codeid="{$vo.order_id}" style="margin-right: 0;font-size:12px;background: #8699e1">已完成待评价</a>{/case}
                {case value="4"} <a href="####" class="layui-btn layui-btn-xs layui-btn-green " data-id="{$vo.order_id}" codeid="{$vo.order_id}" style="margin-right: 0;font-size:12px;">已完成</a>{/case}
                {case value="6"}<a href="####" class="layui-btn layui-btn-xs layui-btn-danger " data-id="{//$v.goods_status}" codeid="{//$v.goods_id}" style="margin-right: 0;font-size:12px;background: #aaa">订单已取消</a>{/case}
                {case value="7"}<a href="####" class="layui-btn layui-btn-xs layui-btn-danger " data-id="{//$v.goods_status}" codeid="{//$v.goods_id}" style="margin-right: 0;font-size:12px;background: #aaa">订单已过期</a>{/case}
                {case value="8"}<a href="####" class="layui-btn layui-btn-xs layui-btn-danger " data-id="{//$v.goods_status}" codeid="{//$v.goods_id}" style="margin-right: 0;font-size:12px;background: #aaa">已退款</a>{/case}
                {default /}
                {/switch}
                {switch name="vo.order_status"}
                {case value="2"}
                <?php if($issuper){?>
                <a href="{:url('admin/order/Refund')}?order_id={$vo.order_id}&source={$vo.source}&order_no={$vo.order_no}" class="layui-btn layui-btn-xs layui-btn-warm _xiao"  style="margin-right: 0;font-size:12px;background: red">退款</a>
                <!--{if($vo['typesource']=='viator')}<a codeid="{$vo.order_id}" class="layui-btn layui-btn-xs layui-btn-warm  calorder"  style="margin-right: 0;font-size:12px;background: red">撤销订单</a>{/if}-->
                <?php }?>
                {/case}
                {default /}
                {/switch}

                <?php  }else{?>
                <a href="####" class="layui-btn layui-btn-xs layui-btn-danger " data-id="{//$v.goods_status}" codeid="{//$v.goods_id}" style="margin-right: 0;font-size:12px;background: #aaa">订单已删除</a>
                <?php  }?>

                {if $vo.source==1}
                {if $vo.order_status==2}
                <a href="####" class="layui-btn layui-btn-xs layui-btn-danger carry_out" data-id="{$vo.order_id}" codeid="{$vo.order_id}" style="margin-right: 0;font-size:12px;">完成订单</a>
                <a href="####" class="layui-btn layui-btn-xs layui-btn-danger shelves" data-id="{$vo.order_status}"  codeid="{$vo.order_id}" style="margin-right: 0;font-size:12px;">取消</a>
                {/if}
                {/if}
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div>{$my_paginate}</div>
    <style type="text/css">
        .pagination p{
            margin:0;
            cursor:pointer
        }
        .pagination{
            height:40px;
            padding:20px 0px;
        }
        .pagination a{
            display:block;
            float:left;
            margin-right:10px;
            padding:2px 12px;
            height:24px;
            border:1px #cccccc solid;
            background:#fff;
            text-decoration:none;
            color:#808080;
            font-size:12px;
            line-height:24px;
        }
        .pagination a:hover{
            color:#009688;
            background: white;
            border:1px #009688 solid;
        }
        .pagination a.cur{
            border:none;
            background:#009688;
            color:#fff;
        }
        .pagination p{
            float:left;
            padding:2px 12px;
            font-size:12px;
            height:24px;
            line-height:24px;
            color:#bbb;
            border:1px #ccc solid;
            background:#fcfcfc;
            margin-right:8px;

        }
        .pagination p.pageRemark{
            border-style:none;
            background:none;
            margin-right:0px;
            padding:4px 0px;
            color:#666;
        }
        .pagination p.pageRemark b{
            color:red;
        }
        .pagination p.pageEllipsis{
            border-style:none;
            background:none;
            padding:4px 0px;
            color:#808080;
        }
        .dates li {font-size: 14px;margin:20px 0}
        .dates li span{float:right}
    </style>


    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>

    <script>
        var message;
        layui.config({
            base: '__JS__/',
            version: '1.0.1'
        }).use(['app', 'message'], function() {
            var app = layui.app,
                $ = layui.jquery,
                layer = layui.layer;
            //将message设置为全局以便子页面调用
            message = layui.message;
            //主入口
            app.set({
                type: 'iframe'
            }).init();
        });

        layui.use(['layer', 'form','laydate','element'], function() {
            var $ = layui.jquery,
                laydate= layui.laydate
                , element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
            laydate.render({
                istime: true,
                elem: '#creattime' //指定元素
                // ,type: 'datetime'
                ,range: '~' //或 range: '~' 来自定义分割字符
            });

            laydate.render({
                istime: true,
                elem: '#travelDate' //指定元素
//                 ,type: 'datetime'
                ,range: '~' //或 range: '~' 来自定义分割字符
            });

        });



    </script>
    <script type="text/javascript">

        $('.delete').click(function(){
            var id = $(this).attr('codeid');
            layer.confirm('确定要删除?', function(index) {
                $.ajax({
                    url:"{:url('admin/coupon/delcoupon')}",
                    data:{id:id},
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })
        $('.calorder').click(function(){
            var id = $(this).attr('codeid');
            var url="calorder?id="+id;
            layer.open({
                type:2,
                content:url,
                area: ['800px', '300px'],
                end:function(){
                    location.reload();
                }
            });
        })
        $('.carry_out').click(function(){
            var id = $(this).attr('codeid');
            layer.confirm('确定要完成该订单，进入待评价阶段?', function(index) {
                $.ajax({
                    url:"{:url('admin/order/carryout')}",
                    data:{id:id},
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })
        $('.shelves').click(function(){
            var id = $(this).attr('codeid');
            var goods_status= $(this).attr('data-id');
            layer.confirm('是否确定取消订单？，取消后不可恢复', function(index) {
                $.ajax({
                    url:"{:url('admin/order/cancel')}",
                    data:{id:id,goods_status:goods_status},
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })
        $('.confirm').click(function(){
            var id = $(this).attr('codeid');
            layer.confirm('是否确认订单？', function(index) {
                $.ajax({
                    url:"{:url('admin/order/confirmStatus')}",
                    data:{id:id},
                    success:function(res) {
                        layer.msg(res);
                        setTimeout(function(){
                            location.reload();
                        },1000)

                    }
                })
            })
        })
    </script>
    <script type="text/javascript">
        layui.use('layer', function(){
            var layer = layui.layer;
            $('.a_menu').click(function(){
                var url = $(this).attr('href');
                var a = 0;
                $.ajax({
                    url:url
                    ,async:false
                    ,success:function(res){
                        if(res.code == 0) {
                            layer.msg(res.msg);
                            a = 1;
                        }
                    }
                })
                if(a === 0) {
                    layer.open({
                        type:2,
                        content:url,
                        area: ['70%', '90%'],
                        end:function(){
                            location.reload();
                        }
                    });
                }
                return false;
            })

            $('._xiao').click(function(){
                var url = $(this).attr('href');
                var a = 0;
                $.ajax({
                    url:url
                    ,async:false
                    ,success:function(res){
                        if(res.code == 0) {
                            layer.msg(res.msg);
                            a = 1;
                        }
                    }
                })
                if(a === 0) {
                    layer.open({
                        type:2,
                        content:url,
                        area: ['300px', '310px'],
                        end:function(){
                            location.reload();
                        }
                    });
                }
                return false;
            })

            $('.preview').click(function(){
                var url = $(this).attr('href');
                layer.open({
                    type:2,
                    content:url,
                    area: ['550px', '400px']
                });
                return false;
            })

        });
    </script>

</body>
</html>
